<?php
/**
 * Created by PhpStorm.
 * User: shkj
 * Date: 2020/4/18
 * Time: 22:01
 */

namespace app\api\controller\v1;


use think\facade\Request;

class Auth extends Base
{
    private $obj;

    public function __construct() {
        $this->obj = model("auth");

    }

    public function select(){
    	$pagesize = Request::param('pagesize');
        $pagenum = Request::param('pagenum');
    	$this->obj->select($pagesize,$pagenum);
    }

      public function all(){
    	$pagesize = Request::param('pagesize');
        $pagenum = Request::param('pagenum');
    	$this->obj->all($pagesize,$pagenum);
    }
    public function delete(){
    	$id = Request::param('id');
    	$this->obj->del($id);
    }

    public function add(){
    	 $data = Request::post();
        $validate = new \app\api\validate\Auth;
        if (!$validate->check($data)) {
            return_json(400,'失败',$validate->getError());
        }else{
    	$this->obj->add($data);
    }
}

     public function detail(){
        $id = Request::param('id');

        $this->obj->detail($id);
    }

     public function edit(){
        $id = Request::param('id');
        $data = Request::post();
       
        $validate = new \app\api\validate\Auth;
        if (!$validate->check($data)) {
            return_json(400,'失败',$validate->getError());
        }else{

            $this->obj->edit($id,$data);
        }
    }
   
}
?>